(function (docs, win) {
  let docEls = docs.documentElement
  let resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'
  let recalc = function () {
    let clientWidth = docEls.clientWidth
    if (!clientWidth) return
    if (clientWidth < 300) clientWidth = 300
    docEls.style.fontSize = clientWidth / 375 * 100 + 'px'
  }
  recalc()
  // 判断是否支持监听事件，不支持则停止
  if (!docs.addEventListener) return
  // 注册翻转事件
  win.addEventListener('resize', recalc, false)
  win.addEventListener(resizeEvt, recalc, false)
})(document, window)
